package com.renchunlin.taobaounion.utils;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.renchunlin.taobaounion.base.BaseApplication;
import com.renchunlin.taobaounion.model.domain.IBaseInfo;
import com.renchunlin.taobaounion.presenter.ITicketPresenter;
import com.renchunlin.taobaounion.ui.activity.TicketActivity;

/*
 * class title:
 * Author by RenChunLin, Email 18957806320@163.com, Date on 2021/1/27.
 * PS: Not easy to write code, please indicate.
 */
public class TicketUtil {
    public static void toTicketPage(Context context, IBaseInfo baseInfo) {
        //特惠列表内容被点击
        //拿到TicketPresenterImpl去加载数据
        String title = baseInfo.getTitle();
        //详情地址
        //String url = bean.getClick_url();
        String url = baseInfo.getUrl();
        if (TextUtils.isEmpty(url)) {
            url = baseInfo.getUrl();
        }
        String cover = baseInfo.getCover();
        ITicketPresenter mTicketPresenter = PresenterManager.getInstance().getTicketPresenter();
        mTicketPresenter.getTicket(title, url, cover);
        context.startActivity(new Intent(context, TicketActivity.class));
    }
}
